package com.toggery.POS.dao;

import com.toggery.POS.entity.Category;
import com.toggery.POS.entity.CategoryExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
    long countByExample(CategoryExample example);

    int deleteByExample(CategoryExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Category record);

    int insertSelective(Category record);

    List<Category> selectByExample(CategoryExample example);

    Category selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Category record, @Param("example") CategoryExample example);

    int updateByExample(@Param("record") Category record, @Param("example") CategoryExample example);

    int updateByPrimaryKeySelective(Category record);

    int updateByPrimaryKey(Category record);
    @Select({
            "select * from Category where id=#{id,jdbcType=INTEGER}"
    })
    Category findById(Integer id);

    @Select({
            "select * from Category"
    })
    List<Category> findAll();


    @Select({
            "select * from Category where Categoryname=#{name,jdbcType=VARCHAR} limit 1"
    })
    Category findByName(String name);

    @Select({
            "select * from Category where Categoryname like #{name,jdbcType=VARCHAR}"
    })
    List<Category> findLikeName(String name);
}